<html>
<head>
  <title>irecv.py</title>
</head>
<body bgcolor="#ffffff" text="#000000">
<pre>
<strong>import</strong> <font color="#2040a0">sys</font>
<strong>import</strong> <font color="#2040a0">Numeric</font>
<strong>import</strong> <font color="#2040a0">mpi</font>

<strong>try</strong><font color="4444FF">:</font>
    <font color="#2040a0">rank</font>,<font color="#2040a0">size</font> <font color="4444FF">=</font> <font color="#2040a0">mpi</font>.<font color="#2040a0">init</font><font color="4444FF">(</font> <font color="#2040a0">len</font><font color="4444FF">(</font><font color="#2040a0">sys</font>.<font color="#2040a0">argv</font><font color="4444FF">)</font>, <font color="#2040a0">sys</font>.<font color="#2040a0">argv</font> <font color="4444FF">)</font>

    <font color="#2040a0">request</font>,<font color="#2040a0">buffer</font> <font color="4444FF">=</font> <font color="#2040a0">mpi</font>.<font color="#2040a0">irecv</font><font color="4444FF">(</font> <font color="#FF0000">10</font>, <font color="#2040a0">mpi</font>.<font color="#2040a0">MPI_INT</font>, <font color="#FF0000">0</font>, <font color="#FF0000">0</font>, <font color="#2040a0">mpi</font>.<font color="#2040a0">MPI_COMM_WORLD</font> <font color="4444FF">)</font>

    <strong>print</strong> <font color="#008000">&quot;Request #: %s&quot;</font><font color="4444FF">%</font><font color="4444FF">(</font><font color="#2040a0">request</font><font color="4444FF">)</font>
    <strong>print</strong> <font color="#008000">&quot;buffer: %s&quot;</font><font color="4444FF">%</font><font color="4444FF">(</font><font color="#2040a0">buffer</font><font color="4444FF">)</font>

    <font color="#2040a0">A</font> <font color="4444FF">=</font> <font color="#2040a0">Numeric</font>.<font color="#2040a0">array</font><font color="4444FF">(</font><font color="4444FF">[</font><font color="#FF0000">1</font>,<font color="#FF0000">2</font>,<font color="#FF0000">3</font>,<font color="#FF0000">4</font>,<font color="#FF0000">5</font>,<font color="#FF0000">6</font>,<font color="#FF0000">7</font>,<font color="#FF0000">8</font>,<font color="#FF0000">9</font>,<font color="#FF0000">10</font><font color="4444FF">]</font>,<font color="#2040a0">Numeric</font>.<font color="#2040a0">Int32</font><font color="4444FF">)</font>
    <font color="#2040a0">send_request</font> <font color="4444FF">=</font> <font color="#2040a0">mpi</font>.<font color="#2040a0">isend</font><font color="4444FF">(</font> <font color="#2040a0">A</font>, <font color="#FF0000">10</font>, <font color="#2040a0">mpi</font>.<font color="#2040a0">MPI_INT</font>, <font color="#FF0000">0</font>, <font color="#FF0000">0</font>, <font color="#2040a0">mpi</font>.<font color="#2040a0">MPI_COMM_WORLD</font> <font color="4444FF">)</font>
    <strong>print</strong> <font color="#008000">&quot;Sending Request: %s&quot;</font><font color="4444FF">%</font><font color="4444FF">(</font><font color="#2040a0">send_request</font><font color="4444FF">)</font>
    <font color="#2040a0">status</font> <font color="4444FF">=</font> <font color="#2040a0">mpi</font>.<font color="#2040a0">wait</font><font color="4444FF">(</font> <font color="#2040a0">request</font> <font color="4444FF">)</font>
    <font color="#2040a0">status</font> <font color="4444FF">=</font> <font color="#2040a0">mpi</font>.<font color="#2040a0">wait</font><font color="4444FF">(</font> <font color="#2040a0">send_request</font> <font color="4444FF">)</font>
    <strong>print</strong> <font color="#008000">&quot;buffer(after send): %s&quot;</font><font color="4444FF">%</font><font color="4444FF">(</font><font color="#2040a0">buffer</font><font color="4444FF">)</font>
    <strong>print</strong> <font color="#008000">&quot;status:&quot;</font>,<font color="#2040a0">status</font>
    <font color="#2040a0">mpi</font>.<font color="#2040a0">finalize</font><font color="4444FF">(</font><font color="4444FF">)</font>
<strong>except</strong><font color="4444FF">:</font>
    <font color="#2040a0">mpi</font>.<font color="#2040a0">finalize</font><font color="4444FF">(</font><font color="4444FF">)</font>
    <strong>raise</strong>

</pre>
<hr>
syntax highlighted by <a href="http://www.palfrader.org/code2html">Code2HTML</a>, v. 0.9.1
</body>
</html>
